home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Toolbox / Visual Basic Toolbox (P.I.E.)(1996).ISO / buttons / 3dhowto / 3d.bas next >
BASIC Source File  |  1993-02-24  |  1KB  |  35 lines

  1. Global Const CTLRECESSED = 0   ' Frame is recessed.
  2. Global Const CTLRAISED = -1    ' Frame is raised.
  3. Global Const BKGNDGRAY = 192   ' Background Gray.
  4. Global Const DARKGRAY = 64     ' Dark Gray
  5. Global Const LIGHTGRAY = 255   ' Light Gray (white).
  6. Global Const DEFAULTWIDTH = 3  ' Default Frame Width
  7. Global FrameWidth As Integer   ' Width of 3d frame (in pixels).
  8.  
  9. Sub HighLight (C As Control, InOut As Integer)
  10. ' Convert ScaleMode of form to pixels.
  11. ' Set up colors for borders on InOut.  For recessed control:
  12. '       top & left = dark, bottom & right = left
  13. '       opposite for raised controls.
  14.     C.Parent.ScaleMode = 3
  15.     If InOut = CTLRAISED Then
  16.         TLShade& = RGB(LIGHTGRAY, LIGHTGRAY, LIGHTGRAY)
  17.         BRShade& = RGB(DARKGRAY, DARKGRAY, DARKGRAY)
  18.     Else
  19.         TLShade& = RGB(DARKGRAY, DARKGRAY, DARKGRAY)
  20.         BRShade& = RGB(LIGHTGRAY, LIGHTGRAY, LIGHTGRAY)
  21.     End If
  22. ' Now draw the Frame Around the Control, on the Parent Form.
  23.     For I% = 1 To FrameWidth
  24.         T% = C.Top - I%
  25.         L% = C.Left - I%
  26.         H% = C.Height + 2 * I%
  27.         W% = C.Width + 2 * I%
  28.         C.Parent.Line (L%, T%)-Step(0, H%), TLShade&   ' left side
  29.         C.Parent.Line (L%, T%)-Step(W%, 0), TLShade&   ' top
  30.         C.Parent.Line (L% + W%, T%)-Step(0, H%), BRShade& ' right side
  31.         C.Parent.Line (L%, T% + H%)-Step(W%, 0), BRShade&  ' bottom
  32.     Next I%
  33. End Sub
  34.  
  35.